/* #region variables */
:root {
  --color-text: #333;
  --color-text-sidebar: #777;
  --color-muted: #999;
  --color-link: hsl(210, 70%, 50%);
  --color-background: white;
  --color-background-code: #f2f2f2;
  --color-background-sidebar: #fafafa;
  --color-background-sidebar-hover: #f2f2f2;
  --color-border: #eee;
  --color-header-shadow: rgba(0, 0, 0, 0.1);
  --height-header: 3rem;
  --width-sidebar: 18rem;
  /* 42 words per line is the best, 42 * 16 + 48 + 48 = 48 * 16 = 48rem */
  --width-article: 48rem;
  --width-article-padding: 3rem;
  --width-toc: 12rem;
}

html.is_dark {
  --color-text: #aaa;
  --color-text-sidebar: #777;
  --color-muted: #777;
  --color-link: hsl(210, 60%, 60%);
  --color-background: #222;
  --color-background-code: #333;
  --color-background-sidebar: #1a1a1a;
  --color-background-sidebar-hover: #111;
  --color-border: #333;
  --color-header-shadow: rgba(0, 0, 0, 0.8);
}
/* #endregion */

/* #region reset */
* {
  box-sizing: border-box;
}
html {
  color: var(--color-text);
  background-color: var(--color-background);
  font-size: 16px;
  line-height: 1.5;
}
body {
  margin: 0;
  padding: 0;
}
h1 {
  font-size: 32px;
}
h2 {
  font-size: 24px;
}
h3 {
  font-size: 18px;
}
h4,
h5,
h6 {
  font-size: 16px;
}
hr {
  display: block;
  height: 2px;
  border: 0;
  border-top: 1px solid var(--color-border);
}

a {
  color: var(--color-link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

blockquote {
  border-left: 5px solid var(--color-border);
  overflow: auto;
  color: var(--color-muted);
}

code {
  font-size: 85%;
  padding: 0.2em 0.3em;
  background-color: var(--color-background-code);
}
pre,
pre[class*='language-'] {
  font-size: 13px;
}
pre code {
  padding: 0;
}

html.is_dark img {
  opacity: 0.7;
  transition: opacity 0.3s ease-in-out;
}
html.is_dark img:hover {
  opacity: 1;
}
/* #endregion */

/* #region paddings */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 2rem 0 0 0;
}
p,
ul,
ol,
blockquote,
pre {
  margin: 1rem 0 0 0;
}
ul ul,
ul ol,
ol ul,
ol ol {
  margin: 0;
}
ul,
ol {
  padding: 0 0 0 2rem;
}
hr {
  margin: 2rem 0 2rem 0;
}
pre,
pre[class*='language-'] {
  margin: 1rem 0 0 0;
}
blockquote {
  padding: 0.5rem 0 0.5rem 1rem;
}
blockquote > *:first-child {
  margin-top: 0;
}
/* #endregion */

/* #region header */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: var(--height-header);
  line-height: var(--height-header);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 0 0.5rem var(--color-header-shadow);
  background-color: var(--color-background);
  z-index: 100;
}
header > * {
  display: inline-block;
}
header h1 {
  margin-top: 0;
  vertical-align: middle;
}
header h1 a {
  display: block;
  width: var(--width-sidebar);
  padding: 0 2rem;
  font-size: 20px;
  color: var(--color-text);
}
header h1 a:hover {
  text-decoration: none;
}
header ul {
  margin: 0;
  padding: 0;
}
header li {
  display: inline-block;
  margin: 0 0 0 2rem;
  vertical-align: middle;
}
.toggle_dark {
  cursor: pointer;
}
.toggle_dark span {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-size: 20px;
}
.toggle_dark .sun-l,
.toggle_dark .moon {
  display: none;
}
.is_dark .toggle_dark .sun-l,
.is_dark .toggle_dark .moon {
  display: inline-block;
}
.is_dark .toggle_dark .sun,
.is_dark .toggle_dark .moon-l {
  display: none;
}
/* #endregion */

/* #region sidebar */
.sidebar {
  position: fixed;
  top: var(--height-header);
  left: 0;
  width: var(--width-sidebar);
  height: calc(100vh - var(--height-header));
  overflow-y: auto;
  padding: 2rem 0 2rem 1rem;
  background-color: var(--color-background-sidebar);
  border-right: 1px solid var(--color-border);
}
.sidebar ol {
  padding: 0;
  margin: 0;
  list-style: none;
}
.sidebar ol ol {
  padding-left: 1rem;
  font-size: 14px;
}
.sidebar a {
  color: var(--color-text-sidebar);
  text-decoration: none;
  padding: 6px 15px;
  display: block;
  outline: 1px solid transparent;
}
.sidebar a.active {
  background-color: var(--color-background);
  outline-color: var(--color-border) !important;
  color: var(--color-link) !important;
}
.sidebar a:hover {
  color: var(--color-text);
  text-decoration: none;
  background-color: var(--color-background-sidebar-hover);
}
/* #endregion */

/* #region article */
.main {
  margin: var(--height-header) 0 0 var(--width-sidebar);
  display: flex;
  justify-content: center;
}
.main-article {
  overflow: auto;
  padding-bottom: 2rem;
  width: var(--width-article);
  max-width: var(--width-article);
  padding: 0 var(--width-article-padding);
}
article.loading {
  min-height: calc(100vh - var(--height-header) - 2rem);
  display: flex;
  justify-content: center;
  align-items: center;
}
article img {
  max-width: 100%;
}

.anchor,
.anchor:hover {
  opacity: 0;
  text-decoration: none;
  color: var(--color-muted);
  font-weight: normal;
  margin-left: 0.5em;
}
.anchor:hover {
  color: var(--color-link);
}

h1:hover .anchor,
h2:hover .anchor,
h3:hover .anchor,
h4:hover .anchor,
h5:hover .anchor,
h6:hover .anchor {
  opacity: 1;
}
/* #endregion */

/* #region toc */
.main-toc {
  width: calc(var(--width-toc) + 2rem);
  min-width: calc(var(--width-toc) + 2rem);
  font-size: 14px;
  line-height: 1.25;
  padding: 2rem 2rem 2rem 0;
}
.toc {
  width: var(--width-toc);
  min-width: var(--width-toc);
  position: fixed;
}
.toc ol {
  padding: 0;
  margin: 0;
  list-style: none;
}
.toc ol ol {
  padding-left: 1rem;
}
.toc li {
  margin-top: 5px;
}
.toc a {
  color: var(--color-text-sidebar);
  text-decoration: none;
}
.toc a.active {
  color: var(--color-link) !important;
}
.toc a:hover {
  color: var(--color-text);
  text-decoration: none;
}
/* #endregion */

/* #region gitalk */
.gt-container {
  margin: 0 auto;
  color: var(--color-text);
  fill: var(--color-text);
}
.is_dark #gitalk-container * {
  border-color: var(--color-border);
}
.is_dark .gt-container .gt-btn {
  background-color: hsl(210, 70%, 40%);
}
.is_dark .gt-container .gt-btn:hover {
  background-color: hsl(210, 70%, 35%);
}
.is_dark .gt-container .gt-header-textarea,
.is_dark .gt-container .gt-popup,
.is_dark .gt-container .gt-comment-content,
.is_dark .gt-container .gt-comment-admin .gt-comment-content,
.is_dark .gt-container .gt-header-preview {
  background-color: var(--color-background-sidebar);
  color: var(--color-text);
}
.is_dark .gt-container .gt-btn-preview {
  background-color: var(--color-background-sidebar);
}
.is_dark .gt-container .gt-header-textarea:hover,
.is_dark .gt-container .gt-header-textarea:focus,
.is_dark .gt-container .gt-btn-preview:hover {
  background-color: var(--color-background-sidebar-hover);
}
.is_dark .gt-container a.is--active,
.is_dark .gt-container a.is--active:hover {
  color: var(--color-text);
}
.is_dark .gt-container .gt-comment-body {
  color: var(--color-text) !important;
}
.is_dark .gt-container .gt-comment-content:hover {
  box-shadow: none;
}
.is_dark .markdown-body .highlight pre,
.markdown-body pre {
  opacity: 0.7;
}
/* #endregion */
